<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Template • TodoMVC</title>
    <style>
        [ng-cloak]{
            display: none;
        }
    </style>
    <link rel="stylesheet" href="node_modules/todomvc-app-css/index.css">
    <link rel="stylesheet" href="css/app.css">
</head>

<body>
<!--开始-->
    <section class="todoapp" ng-app='todoApp' ng-controller='todoCtrl' ng-cloak="">

        <header class="header">

            <h1>todos</h1>

            <form action="" ng-submit='addTodo()'>
                <input ng-model='todoText' class="new-todo" placeholder="What needs to be done?" autofocus>
            </form>

        </header>
        <!-- This section should be hidden by default and shown when there are todos -->

        <section class="main">
            <!--全部切换-->
            <input class="toggle-all" type="checkbox" ng-model='toggleAll' ng-click='changeAll()' ng-show='todoList.length>0?true:false'>

            <label for="toggle-all">Mark all as complete</label>

            <ul class="todo-list" >
                <!-- These are here just to show the structure of the list items -->
                <!-- List items should get the class `editing` when editing and `completed` when marked as completed -->
                <!--匹配到其中一个todo.id改变修改状态 li就是一个整体-->
                <li todo-focus ng-repeat='todo in todoList | filter:todoListFilter'  ng-class='{"completed":todo.isCompleted,"editing":todo.id==editingID}'>

                    <div class="view">
                        <input class="toggle" type="checkbox" checked ng-model='todo.isCompleted'>
                        <!--双击传入一个id-->
                        <label ng-dblclick='editTodo(todo.id)'>{{todo.text}}</label>
                        <!--点击删除 传入点击的对象-->
                        <button class="destroy" ng-click='delTodo(todo)'></button>
                    </div>
                    <!--失去焦点传入对象 改变样式-->
                    <input ng-blur='editInit(todo)' class="edit" ng-model='todo.text'>
                </li>

            </ul>
        </section>

        <!-- This footer should hidden by default and shown when there are todos -->
        <footer class="footer" ng-show="todoList.length>0?true:false">
            <!-- This should be `0 items left` by default -->
            <span class="todo-count"><strong>{{todoCount}}</strong> item left</span>
            <!-- Remove this if you don't implement routing -->
            <ul class="filters" >
                <li>
                    <a  ng-click='changeFilter(0)'ng-class='{"selected":todoListFilter.isCompleted==undefined}' href="#/">All</a>
                </li>
                <li>
                    <a ng-click='changeFilter(1)'ng-class='{"selected":todoListFilter.isCompleted==false}' href="#/active">Active</a>
                </li>
                <li>
                    <a ng-click='changeFilter(2)'ng-class='{"selected":todoListFilter.isCompleted==true}' href="#/completed">Completed</a>
                </li>
            </ul>
            <!-- Hidden if no completed items are left ↓ -->
            <!--点击的时候清除数据,如果没有数据隐藏-->
            <button ng-if="isShowClearCompleted" ng-click="clearCompleted()" class="clear-completed">Clear completed</button>
        </footer>
    </section>
    <footer class="info">
        <p>Double-click to edit a todo</p>
        <p>Created by <a href="http://todomvc.com">itcast</a></p>
        <p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
    </footer>
    <script src="js/angular.js"></script>
    <script src="js/directive.js"></script>
    <script src="js/service.js"></script>
    <script src="js/app.js"></script>

</body>

</html>
